#ifndef ADC_H_
#define ADC_H_

// comunes
#define ADC_P1_0 0x00
#define ADC_P1_1 0x01
#define ADC_P1_2 0x02
#define ADC_P1_3 0x03
#define ADC_P1_4 0x04
#define ADC_P1_5 0x05
#define ADC_P1_6 0x06
#define ADC_P1_7 0x07
#define ADC_P2_0 0x08
#define ADC_P2_1 0x09
#define ADC_P2_2 0x0A
#define ADC_P2_3 0x0B
#define ADC_P3_0 0x10

// negativo
#define ADC_VREF 0x1E
#define ADC_GND 0x1F

// positivo
#define ADC_TEMP 0x1E
#define ADC_VDD  0x1F

// buffer circular en [first, last), first==last -> buffer vacio
#define ADC_BUFFER_SIZE 8
extern unsigned xdata adc_measure_buffer[ADC_BUFFER_SIZE];
extern unsigned adc_buffer_first;
extern unsigned adc_buffer_last;


void init_adc (void);

// usa el timer 3
void adc_start ();
void adc_stop ();

#endif//ADC_H_
